package com.kaifamiao.demo.d0826;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.stream.Stream;

public class Demo03 {

    public static void main(String[] args) {
        Map<String, Integer> map = new HashMap<>();

        map.put("a", 1);
        map.put("b", 2);
        map.put("c", 3);
        map.put("d", 4);

//        Stream<String> stream1 = map.keySet().stream();
//        Stream<Integer> stream1 = map.values().stream();
        Stream<Map.Entry<String, Integer>> stream = map.entrySet().stream();

        stream.filter(s -> s.getValue() > 2)
                .forEach(s -> System.out.println(s));

        String[] strs = {"刘凯", "陈鹏", "陈晨", "张军全", "张康乐", "张玉霞", "张宝林"};

        Stream<String> stream1 = Arrays.stream(strs);

        stream1.filter(str -> str.startsWith("张"))
                .skip(1)
                .limit(2)
                .forEach(s -> System.out.println(s));

//        Stream.of(1, 2, 3, 4, 5, 6);
    }
}
